package ru.paswd.marketprice.data.repositories

import android.content.Context
import retrofit2.Call
import ru.paswd.marketprice.Server
import ru.paswd.marketprice.api.Api
import ru.paswd.marketprice.listener.OnProcessListener
import java.util.function.Function

open class Repository {
    open fun <T> request(
        context: Context, listener: OnProcessListener<T>, request: Function<Api, Call<T>>) {

        request.apply(Server.withContext(context).getApi())
            .enqueue(RepositoryCallback(listener))
    }
}